package com.sc.nft.feign;

import com.sc.nft.req.wxPay.*;
import com.sc.nft.sup.Result;
import com.sc.nft.vo.wxPay.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestPart;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author：LiGen
 * @Package：com.sc.nft.feign
 * @Project：sc_metago
 * @name：WxMiniUserPayClient
 * @Date：2024/5/16 19:16
 * @Filename：WxMiniUserPayClient
 */
@FeignClient(name = "meta-mall-mini-app", path = "/wxMiniMall/wxPay")
public interface WxMiniPayClient {

    /**
     * JSAPI 支付下单，并返回 JSAPI 调起支付数据 (小程序支付下单)
     *
     * @return
     */
    @PostMapping(value = "/prepay", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<PrepayWithRequestPaymentResponse> prepay(@RequestBody WxPrepayReq req);

    /**
     * 商户订单号查询订单(小程序)
     *
     * @return
     */
    @PostMapping(value = "/queryOrderByOutTradeNo", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<Transaction> queryOrderByOutTradeNo(@RequestBody TradeNoReq req);

    /**
     * 微信支付回调(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/payNotify", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<Transaction> payNotify(@RequestBody NotifyReq req);

    /**
     * 微信退款回调(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/refundPayNotify", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<RefundNotification> refundPayNotify(@RequestBody NotifyReq req);

    /**
     * 关闭订单(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/closeOrder", produces = MediaType.APPLICATION_JSON_VALUE)
    Result closeOrder(@RequestBody TradeNoReq req);

    /**
     * 申请退款(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/refund", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<Refund> refund(@RequestBody WxRefundReq req);

    /**
     * 查询单笔退款(小程序)
     * 查询单笔退款(小程序) （通过商户退款单号 说明：商户系统内部的退款单号，商户系统内部唯一，只能是数字、大小写字母_-|*@ ，同一退款单号多次请求只退一笔。）
     * @param req
     * @return
     */
    @PostMapping(value = "/queryRefund", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<Refund> queryRefund(@RequestBody RefundNoReq req);

    /**
     * 发起商家转账 (小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/batchTransfer", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<InitiateBatchTransferResponse> batchTransfer(@RequestBody BatchTransferReq req);

    /**
     * 查询商家转账通过商户批次单号(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/getTransferBatchByOutNo", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<TransferBatchEntity> getTransferBatchByOutNo(@RequestBody TransferBatchByOutNoReq req);

    /**
     * 通过商家明细单号查询明细单(小程序)
     *
     * @param req
     * @return
     */
    @PostMapping(value = "/getTransferDetailByOutNo", produces = MediaType.APPLICATION_JSON_VALUE)
    Result<TransferDetailEntity> getTransferBatchByOutNo(@RequestBody TransferDetailByOutNoReq req);
}
